<?php

//
// +---------------------------------------------------------+
// | 开发组
// +---------------------------------------------------------+
// | Copyrigh  (c)  2020 The PHP Group
// +---------------------------------------------------------+
// | 广告
// +---------------------------------------------------------+
// | zxc
// | php后端开发
// |
// +———————————————————+
//

namespace App\Models\Api;

use Illuminate\Database\Eloquent\Model;

class Ad extends Model
{

    protected $table = 'ad';
    protected $primaryKey = 'id';
    protected $dateFormat = 'U';// 时间戳
    protected $casts = [
        'created_at' => 'datetime:Y-m-d H:i:s',
        'updated_at' => 'datetime:Y-m-d H:i:s'
    ];

    /**
     * 获取广告
     * @param $cate_id
     */
    public static function getListByCateId($cate_id)
    {
        return self::select(['image'])->where(['status' => 1, 'cate_id' => $cate_id])->get();
    }
}
